import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import eslint from 'vite-plugin-eslint'
// @ts-ignore
import path from 'path'

export default defineConfig({
  envDir: './env',
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    },
    extensions: ['.js', '.jsx', '.ts', '.tsx']
  },
  plugins: [react(), eslint()],
  server: {
    host: '0.0.0.0',
    port: 8080,
    open: false,
    proxy: {  
      '/api': {  
        target: 'http://182.44.15.215:30038',
        // target: 'https://www.gouyintongxun.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')  
      }  
    }
  }
})
